package com.fr.util;

import com.fr.base.StringUtils;
import com.fr.base.core.BaseCoreUtils;
import java.io.File;
import java.util.Calendar;
import java.util.Properties;

public class Consts
{
  private static Properties prop = null;
  public static final String APP_NAME = loadAttribute("APP_NAME", "FineReport");
  public static final String Main_Version = loadAttribute("Main_Version", "6");
  public static final String Minor_Version = loadAttribute("Minor_Version", "5");
  public static final String BORN = loadAttribute("BORN", "2001");
  public static final String COMPANY_NAME = loadAttribute("COMPANY_NAME", "FineReport Software Inc.");
  public static final String WEBSITE_URL = loadAttribute("WEBSITE_URL", "http://www.finereport.com");
  public static final String SUPPORT_EMAIL = loadAttribute("SUPPORT_EMAIL", "support@finereport.com");
  public static final String VERSION = BaseCoreUtils.join(new String[] { Main_Version, ".", Minor_Version });
  public static final String PRODUCT_NAME = BaseCoreUtils.join(new String[] { APP_NAME, " ", VERSION });
  public static final String HISTORY = BORN + "-" + Calendar.getInstance().get(1);
  public static final String FR_HOME = "FR_HOME";
  public static final String ENV_HOME = "ENV_HOME";

  private static String loadAttribute(String paramString1, String paramString2)
  {
    if (prop == null)
    {
      prop = new Properties();
      try
      {
        prop.load(Consts.class.getResourceAsStream("/com/fr/util/build.properties"));
      }
      catch (Exception localException)
      {
      }
    }
    String str = prop.getProperty(paramString1);
    if (StringUtils.isEmpty(str))
      str = paramString2;
    return str;
  }

  public static String getEnvHome()
  {
    String str = System.getProperty("user.home");
    if (str == null)
      str = System.getProperty("userHome");
    File localFile = new File(str + File.separator + "." + APP_NAME + Main_Version + Minor_Version);
    if (!(localFile.exists()))
      Utils.mkdirs(localFile);
    return localFile.getAbsolutePath();
  }
}